<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            position: relative;
        }

        #big_box {
            width: 520px;
            height: 300px;
            background-color: rgba(165, 42, 42, 0.3);
            position: absolute;
            left: 35%;
            margin-top: 3em;
            padding: 10px;
            border-radius: 10px;
            display: none;
        }

        #strip {
            height: 200px;
            width: 0;
            /* border: 1px solid #fff; */
            background-color: rgb(70, 204, 238);
            margin-top: 25px;
            /* margin-left: 10px; */
        }
    </style>
</head>

<body>
    <input type="button" value="click me">
    <div id="big_box">
        <div id="strip"></div>
        <p>?</p>
        <input type="button" value="clear">
    </div>
    <script>
        let clickBtn = document.querySelector('[value="click me"]');
        let big_box = document.getElementById('big_box');
        let strip = document.getElementById('strip');
        let p = document.querySelector('p')
        let clearBtn = document.querySelector('[value="clear"]');
        let number = 0;
        let timer;

        //停止
        clearBtn.onclick = function () {
            big_box.style.display = 'none';
            clearInterval(timer);
            number = 0;
            p.innerText = '0%';
            strip.style.width = '0%'
        }
        //开始
        clickBtn.onclick = function () {
            big_box.style.display = 'block';
            timer = setInterval(function () {
                if (number < 100) {
                    number++;
                    p.innerText = number + '%';
                    strip.style.width = number + '%'
                }
            }, 100);

        }
    </script>
</body>

</html>